<template>
    <el-switch
        v-model="formData[$attrs.prop]"
        v-bind="$attrs"
        @change="doChange"
    ></el-switch>
</template>

<script>
export default {
    props: {
        formData: {
            type: Object,
            default: () => ({})
        },
        onChange: {
            type: [Function, undefined],
            default: undefined
        }
    },
    methods: {
        doChange(e) {
            if (this.onChange) {
                this.onChange(e)
            }
        }
    }
}
</script>

<style></style>
